package com.wlient.basic.designPattern;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;

class Solution {
    List<List<String>> res = new ArrayList<>();
    LinkedList<String> path = new LinkedList<>();
    public List<List<String>> partition(String s) {
        backtracking(0, s);
        return res;
    }

    public void backtracking(int startIndex, String s){
        if(startIndex == s.length()){
            res.add(new ArrayList<>(path));
            return;
        }

        StringBuffer sb = new StringBuffer();
        for(int i = startIndex; i < s.length(); i++){
            sb.append(s.charAt(i));
            if(isPalindrome(sb)){
                path.addLast(sb.toString());
                backtracking(i + 1, s);
                path.pollLast();
            }
        }
    }
    public boolean isPalindrome(StringBuffer s){
        for(int j = s.length() - 1,k = 0; k < j;j--,k++){
            if(s.charAt(j) != s.charAt(k)) return false;
        }
        return true;
    }



    public void concatenatedBinary(int n) {
        System.out.println(1<<3);
    }

    public static void main(String[] args) {
        Solution solution = new Solution();
        solution.concatenatedBinary(3);
    }
}
